import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 佣金提现信息 */
export interface BrokerageWithdraw {
          id: number; // 编号
          userId?: number; // 用户编号
          price?: number; // 提现金额
          feePrice?: number; // 提现手续费
          totalPrice?: number; // 当前总佣金
          type?: number; // 提现类型：1-钱包；2-银行卡；3-微信；4-支付宝
          name: string; // 真实姓名
          accountNo: string; // 账号
          bankName: string; // 银行名称
          bankAddress: string; // 开户地址
          accountQrCodeUrl: string; // 收款码
          status?: number; // 状态：0-审核中，10-审核通过 20-审核不通过；预留：11 - 提现成功；21-提现失败
          auditReason: string; // 审核驳回原因
          auditTime: string | Dayjs; // 审核时间
          remark: string; // 备注
  }

// 佣金提现 API
export const BrokerageWithdrawApi = {
  // 查询佣金提现分页
  getBrokerageWithdrawPage: async (params: any) => {
    return await request.get({ url: `/trade/brokerage-withdraw/page`, params })
  },

  // 查询佣金提现详情
  getBrokerageWithdraw: async (id: number) => {
    return await request.get({ url: `/trade/brokerage-withdraw/get?id=` + id })
  },

  // 新增佣金提现
  createBrokerageWithdraw: async (data: BrokerageWithdraw) => {
    return await request.post({ url: `/trade/brokerage-withdraw/create`, data })
  },

  // 修改佣金提现
  updateBrokerageWithdraw: async (data: BrokerageWithdraw) => {
    return await request.put({ url: `/trade/brokerage-withdraw/update`, data })
  },

  // 删除佣金提现
  deleteBrokerageWithdraw: async (id: number) => {
    return await request.delete({ url: `/trade/brokerage-withdraw/delete?id=` + id })
  },

  /** 批量删除佣金提现 */
  deleteBrokerageWithdrawList: async (ids: number[]) => {
    return await request.delete({ url: `/trade/brokerage-withdraw/delete-list?ids=${ids.join(',')}` })
  },

  // 导出佣金提现 Excel
  exportBrokerageWithdraw: async (params) => {
    return await request.download({ url: `/trade/brokerage-withdraw/export-excel`, params })
  }
}